clear
clear matrix
set mem 300m
use ".../ISSP Data/ZA4700_F1.dta"

* rename variables and calculate spending control
gen spendenviron=V17
gen spendhealth=V18
gen spendeduc=V20
gen spendpensions=V22
gen spendunem=V23
gen spendarts=V24

factor V17 V19 V21 V24
predict spendcontrol

* create income deciles for countries
gen income=.

*Australia
gen incdecil=.
drop if AU_RINC>=900000 & V3a==36
gen aux=104000/10
replace incdecil=1 if AU_RINC<aux
replace incdecil=2 if AU_RINC>=aux
replace incdecil=3 if AU_RINC>=2*aux
replace incdecil=4 if AU_RINC>=3*aux
replace incdecil=5 if AU_RINC>=4*aux
replace incdecil=6 if AU_RINC>=5*aux
replace incdecil=7 if AU_RINC>=6*aux
replace incdecil=8 if AU_RINC>=7*aux
replace incdecil=9 if AU_RINC>=8*aux
replace incdecil=10 if AU_RINC>=9*aux
replace income=incdecil if V3a==36
drop incdecil
drop aux

*Canada
gen incdecil=CA_RINC/10000
replace income=incdecil if V3a==124
drop incdecil

*Switzerland
gen incdecil=.
drop if CH_RINC>=900000 & V3a==756
gen aux=19000/10
replace incdecil=1 if CH_RINC<aux
replace incdecil=2 if CH_RINC>=aux
replace incdecil=3 if CH_RINC>=2*aux
replace incdecil=4 if CH_RINC>=3*aux
replace incdecil=5 if CH_RINC>=4*aux
replace incdecil=6 if CH_RINC>=5*aux
replace incdecil=7 if CH_RINC>=6*aux
replace incdecil=8 if CH_RINC>=7*aux
replace incdecil=9 if CH_RINC>=8*aux
replace incdecil=10 if CH_RINC>=9*aux
replace income=incdecil if V3a==756
drop incdecil
drop aux

*Germany
gen incdecil=.
drop if DE_RINC>=900000 & V3a==276
gen aux=8000/10
replace incdecil=1 if DE_RINC<aux
replace incdecil=2 if DE_RINC>=aux
replace incdecil=3 if DE_RINC>=2*aux
replace incdecil=4 if DE_RINC>=3*aux
replace incdecil=5 if DE_RINC>=4*aux
replace incdecil=6 if DE_RINC>=5*aux
replace incdecil=7 if DE_RINC>=6*aux
replace incdecil=8 if DE_RINC>=7*aux
replace incdecil=9 if DE_RINC>=8*aux
replace incdecil=10 if DE_RINC>=9*aux
replace income=incdecil if V3a==276
drop incdecil
drop aux

*Denmark
gen incdecil=.
drop if DK_RINC>=900000 & V3a==208
gen aux=650000/10
replace incdecil=1 if DK_RINC<aux
replace incdecil=2 if DK_RINC>=aux
replace incdecil=3 if DK_RINC>=2*aux
replace incdecil=4 if DK_RINC>=3*aux
replace incdecil=5 if DK_RINC>=4*aux
replace incdecil=6 if DK_RINC>=5*aux
replace incdecil=7 if DK_RINC>=6*aux
replace incdecil=8 if DK_RINC>=7*aux
replace incdecil=9 if DK_RINC>=8*aux
replace incdecil=10 if DK_RINC>=9*aux
replace income=incdecil if V3a==208
drop incdecil
drop aux

*Spain
gen incdecil=.
drop if ES_RINC>=900000 & V3a==724
gen aux=7000/10
replace incdecil=1 if ES_RINC<aux
replace incdecil=2 if ES_RINC>=aux
replace incdecil=3 if ES_RINC>=2*aux
replace incdecil=4 if ES_RINC>=3*aux
replace incdecil=5 if ES_RINC>=4*aux
replace incdecil=6 if ES_RINC>=5*aux
replace incdecil=7 if ES_RINC>=6*aux
replace incdecil=8 if ES_RINC>=7*aux
replace incdecil=9 if ES_RINC>=8*aux
replace incdecil=10 if ES_RINC>=9*aux
replace income=incdecil if V3a==724
drop incdecil
drop aux

*Finland
gen incdecil=.
drop if FI_RINC>=900000 & V3a==246
gen aux=8000/10 /*not max value in sample, which would bias the distribution of incomes; same max value as in Germany*/
replace incdecil=1 if FI_RINC<aux
replace incdecil=2 if FI_RINC>=aux
replace incdecil=3 if FI_RINC>=2*aux
replace incdecil=4 if FI_RINC>=3*aux
replace incdecil=5 if FI_RINC>=4*aux
replace incdecil=6 if FI_RINC>=5*aux
replace incdecil=7 if FI_RINC>=6*aux
replace incdecil=8 if FI_RINC>=7*aux
replace incdecil=9 if FI_RINC>=8*aux
replace incdecil=10 if FI_RINC>=9*aux
replace income=incdecil if V3a==246
drop incdecil
drop aux

*France
gen incdecil=.
drop if FR_RINC>=900000 & V3a==250
gen aux=8250/10 
replace incdecil=1 if FR_RINC<aux
replace incdecil=2 if FR_RINC>=aux
replace incdecil=3 if FR_RINC>=2*aux
replace incdecil=4 if FR_RINC>=3*aux
replace incdecil=5 if FR_RINC>=4*aux
replace incdecil=6 if FR_RINC>=5*aux
replace incdecil=7 if FR_RINC>=6*aux
replace incdecil=8 if FR_RINC>=7*aux
replace incdecil=9 if FR_RINC>=8*aux
replace incdecil=10 if FR_RINC>=9*aux
replace income=incdecil if V3a==250
drop incdecil
drop aux


*Great Britain
gen incdecil=.
drop if GB_RINC>=900000 & V3a==826
gen aux=59000/10 
replace incdecil=1 if GB_RINC<aux
replace incdecil=2 if GB_RINC>=aux
replace incdecil=3 if GB_RINC>=2*aux
replace incdecil=4 if GB_RINC>=3*aux
replace incdecil=5 if GB_RINC>=4*aux
replace incdecil=6 if GB_RINC>=5*aux
replace incdecil=7 if GB_RINC>=6*aux
replace incdecil=8 if GB_RINC>=7*aux
replace incdecil=9 if GB_RINC>=8*aux
replace incdecil=10 if GB_RINC>=9*aux
replace income=incdecil if V3a==826
drop incdecil
drop aux

*Ireland
gen incdecil=.
drop if IE_RINC>=900000 & V3a==372
gen aux=90000/10 /*not actual max value in sample*/
replace incdecil=1 if IE_RINC<aux
replace incdecil=2 if IE_RINC>=aux
replace incdecil=3 if IE_RINC>=2*aux
replace incdecil=4 if IE_RINC>=3*aux
replace incdecil=5 if IE_RINC>=4*aux
replace incdecil=6 if IE_RINC>=5*aux
replace incdecil=7 if IE_RINC>=6*aux
replace incdecil=8 if IE_RINC>=7*aux
replace incdecil=9 if IE_RINC>=8*aux
replace incdecil=10 if IE_RINC>=9*aux
replace income=incdecil if V3a==372
drop incdecil
drop aux

*Japan
gen incdecil=.
drop if JP_RINC>=90000000 & V3a==392
gen aux=20000000/10 
replace incdecil=1 if JP_RINC<aux
replace incdecil=2 if JP_RINC>=aux
replace incdecil=3 if JP_RINC>=2*aux
replace incdecil=4 if JP_RINC>=3*aux
replace incdecil=5 if JP_RINC>=4*aux
replace incdecil=6 if JP_RINC>=5*aux
replace incdecil=7 if JP_RINC>=6*aux
replace incdecil=8 if JP_RINC>=7*aux
replace incdecil=9 if JP_RINC>=8*aux
replace incdecil=10 if JP_RINC>=9*aux
replace income=incdecil if V3a==392
drop incdecil
drop aux

*Netherlands
gen incdecil=.
drop if NL_RINC>=900000 & V3a==528
gen aux=5500/10 
replace incdecil=1 if NL_RINC<aux
replace incdecil=2 if NL_RINC>=aux
replace incdecil=3 if NL_RINC>=2*aux
replace incdecil=4 if NL_RINC>=3*aux
replace incdecil=5 if NL_RINC>=4*aux
replace incdecil=6 if NL_RINC>=5*aux
replace incdecil=7 if NL_RINC>=6*aux
replace incdecil=8 if NL_RINC>=7*aux
replace incdecil=9 if NL_RINC>=8*aux
replace incdecil=10 if NL_RINC>=9*aux
replace income=incdecil if V3a==528
drop incdecil
drop aux

*Norway
gen incdecil=.
drop if NO_RINC>=9000000 & V3a==578
gen aux=1000000/10 /*not actual max value in sample*/
replace incdecil=1 if NO_RINC<aux
replace incdecil=2 if NO_RINC>=aux
replace incdecil=3 if NO_RINC>=2*aux
replace incdecil=4 if NO_RINC>=3*aux
replace incdecil=5 if NO_RINC>=4*aux
replace incdecil=6 if NO_RINC>=5*aux
replace incdecil=7 if NO_RINC>=6*aux
replace incdecil=8 if NO_RINC>=7*aux
replace incdecil=9 if NO_RINC>=8*aux
replace incdecil=10 if NO_RINC>=9*aux
replace income=incdecil if V3a==578
drop incdecil
drop aux

*New Zealand
gen incdecil=.
replace incdecil=1 if NZ_RINC==5000 & V3a==554
replace incdecil=2 if NZ_RINC==12500 & V3a==554
replace incdecil=3 if NZ_RINC==17500 & V3a==554
replace incdecil=4 if NZ_RINC==22500 & V3a==554
replace incdecil=5 if NZ_RINC==27500 & V3a==554
replace incdecil=6 if NZ_RINC==35000 & V3a==554
replace incdecil=7 if NZ_RINC==45000 & V3a==554
replace incdecil=8 if NZ_RINC==60000 & V3a==554
replace incdecil=9 if NZ_RINC==85000 & V3a==554
replace incdecil=10 if NZ_RINC==120000 & V3a==554
replace income=incdecil if V3a==554
drop incdecil

*Portugal
gen incdecil=.
drop if PT_RINC>=900000 & V3a==620
gen aux=3000/10 
replace incdecil=1 if PT_RINC<aux
replace incdecil=2 if PT_RINC>=aux
replace incdecil=3 if PT_RINC>=2*aux
replace incdecil=4 if PT_RINC>=3*aux
replace incdecil=5 if PT_RINC>=4*aux
replace incdecil=6 if PT_RINC>=5*aux
replace incdecil=7 if PT_RINC>=6*aux
replace incdecil=8 if PT_RINC>=7*aux
replace incdecil=9 if PT_RINC>=8*aux
replace incdecil=10 if PT_RINC>=9*aux
replace income=incdecil if V3a==620
drop incdecil
drop aux

*Sweden
gen incdecil=.
drop if SE_RINC>=900000 & V3a==752
gen aux=80000/10 /*not actual max value in sample*/
replace incdecil=1 if SE_RINC<aux
replace incdecil=2 if SE_RINC>=aux
replace incdecil=3 if SE_RINC>=2*aux
replace incdecil=4 if SE_RINC>=3*aux
replace incdecil=5 if SE_RINC>=4*aux
replace incdecil=6 if SE_RINC>=5*aux
replace incdecil=7 if SE_RINC>=6*aux
replace incdecil=8 if SE_RINC>=7*aux
replace incdecil=9 if SE_RINC>=8*aux
replace incdecil=10 if SE_RINC>=9*aux
replace income=incdecil if V3a==752
drop incdecil
drop aux

*United States
gen incdecil=.
drop if US_RINC>=900000 & V3a==840
gen aux=120000/10 /*not actual max value in sample*/
replace incdecil=1 if US_RINC<aux
replace incdecil=2 if US_RINC>=aux
replace incdecil=3 if US_RINC>=2*aux
replace incdecil=4 if US_RINC>=3*aux
replace incdecil=5 if US_RINC>=4*aux
replace incdecil=6 if US_RINC>=5*aux
replace incdecil=7 if US_RINC>=6*aux
replace incdecil=8 if US_RINC>=7*aux
replace incdecil=9 if US_RINC>=8*aux
replace incdecil=10 if US_RINC>=9*aux
replace income=incdecil if V3a==840
drop incdecil
drop aux

*Czech Republic
gen incdecil=.
drop if CZ_RINC>=900000 & V3a==203
gen aux=65000/10 
replace incdecil=1 if CZ_RINC<aux
replace incdecil=2 if CZ_RINC>=aux
replace incdecil=3 if CZ_RINC>=2*aux
replace incdecil=4 if CZ_RINC>=3*aux
replace incdecil=5 if CZ_RINC>=4*aux
replace incdecil=6 if CZ_RINC>=5*aux
replace incdecil=7 if CZ_RINC>=6*aux
replace incdecil=8 if CZ_RINC>=7*aux
replace incdecil=9 if CZ_RINC>=8*aux
replace incdecil=10 if CZ_RINC>=9*aux
replace income=incdecil if V3a==203
drop incdecil
drop aux

*Hungary
gen incdecil=.
drop if HU_RINC>=900000 & V3a==348
gen aux=500000/10 
replace incdecil=1 if HU_RINC<aux
replace incdecil=2 if HU_RINC>=aux
replace incdecil=3 if HU_RINC>=2*aux
replace incdecil=4 if HU_RINC>=3*aux
replace incdecil=5 if HU_RINC>=4*aux
replace incdecil=6 if HU_RINC>=5*aux
replace incdecil=7 if HU_RINC>=6*aux
replace incdecil=8 if HU_RINC>=7*aux
replace incdecil=9 if HU_RINC>=8*aux
replace incdecil=10 if HU_RINC>=9*aux
replace income=incdecil if V3a==348
drop incdecil
drop aux

*Poland
gen incdecil=.
drop if PL_RINC>=900000 & V3a==616
gen aux=10000/10 
replace incdecil=1 if PL_RINC<aux
replace incdecil=2 if PL_RINC>=aux
replace incdecil=3 if PL_RINC>=2*aux
replace incdecil=4 if PL_RINC>=3*aux
replace incdecil=5 if PL_RINC>=4*aux
replace incdecil=6 if PL_RINC>=5*aux
replace incdecil=7 if PL_RINC>=6*aux
replace incdecil=8 if PL_RINC>=7*aux
replace incdecil=9 if PL_RINC>=8*aux
replace incdecil=10 if PL_RINC>=9*aux
replace income=incdecil if V3a==616
drop incdecil
drop aux


*keep only countries of interest
keep if V3a==840 | V3a==752 | V3a==620 | V3a==554 | V3a==578 | V3a==528 | V3a==392 | V3a==372 | V3a==826 | V3a==250 | V3a==246 | V3a==724 | V3a==208 | V3a==276 | V3a==756 | V3a==124 | V3a==36 | V3a==203 | V3a==348 | V3a==616



*macro level variable: inequality, most data for 2006, net GINI household income inequality, source: Solt SWIID 2009
gen ineq=.
*US
replace ineq=37.8572 if V3a==840
*Sweden
replace ineq=24.2004 if V3a==752
*Portugal
replace ineq=37.52089 if V3a==620
*New Zealand
replace ineq=32.42708 if V3a==554
*Norway
replace ineq=26.5244 if V3a==578
*Netherlands
replace ineq=27.15117 if V3a==528
*Japan, data for 2003
replace ineq=32.44889 if V3a==392
*Ireland
replace ineq=32.18043 if V3a==372
*Great Britain
replace ineq=35.66239 if V3a==826
*France
replace ineq=27.14329 if V3a==250
*Finland
replace ineq=25.56551 if V3a==246
*Spain
replace ineq=30.96301 if V3a==724
*Denmark
replace ineq=23.87275 if V3a==208
*Germany
replace ineq=29.64987 if V3a==276
*Switzerland, data for 2004
replace ineq=27.42356 if V3a==756
*Canada, data for 2005
replace ineq=31.80177 if V3a==124
*Australia, data for 2005
replace ineq=30.42507 if V3a==36
*Czech Republic
replace ineq=25.4458 if V3a==203
*Hungary
replace ineq=28.8187 if V3a==348
*Poland
replace ineq=30.7682 if V3a==616



*new entries!!!
*macro level variable: inequality, 2005, net GINI household income inequality, source: Solt SWIID 2009
gen ineq2=.
*US
replace ineq2=37.04594 if V3a==840
*Sweden
replace ineq2=23.7 if V3a==752
*Portugal
replace ineq2=36.99985 if V3a==620
*New Zealand
replace ineq2=33.07498 if V3a==554
*Norway
replace ineq2=25.33828 if V3a==578
*Netherlands
replace ineq2=27.35991 if V3a==528
*Japan
replace ineq2=35.87954 if V3a==392
*Ireland
replace ineq2=31.51415 if V3a==372
*Great Britain
replace ineq2=34.95613 if V3a==826
*France
replace ineq2=27.76878 if V3a==250
*Finland
replace ineq2=25.69222 if V3a==246
*Spain
replace ineq2=31.57463 if V3a==724
*Denmark
replace ineq2=23.4621 if V3a==208
*Germany
replace ineq2=28.11079 if V3a==276
*Switzerland
replace ineq2=31.06505 if V3a==756
*Canada
replace ineq2=31.68298 if V3a==124
*Australia
replace ineq2=31.57074 if V3a==36
*Czech Republic
replace ineq2=25.4458 if V3a==203
*Hungary
replace ineq2=28.8187 if V3a==348
*Poland
replace ineq2=30.7682 if V3a==616


*macro level variable: public social spending, % of GDP, 2005, source: OECD Factbook.
gen wfs=.
*US
replace wfs=15.9 if V3a==840
*Sweden
replace wfs=29.4 if V3a==752
*Portugal, 2004
replace wfs=23.1 if V3a==620
*New Zealand
replace wfs=18.5 if V3a==554
*Norway
replace wfs=21.6 if V3a==578
*Netherlands
replace wfs=20.9 if V3a==528
*Japan
replace wfs=18.6 if V3a==392
*Ireland
replace wfs=16.7 if V3a==372
*Great Britain
replace wfs=21.3 if V3a==826
*France
replace wfs=29.2 if V3a==250
*Finland
replace wfs=26.1 if V3a==246
*Spain
replace wfs=21.2 if V3a==724
*Denmark
replace wfs=26.9 if V3a==208
*Germany
replace wfs=26.7 if V3a==276
*Switzerland
replace wfs=20.3 if V3a==756
*Canada
replace wfs=16.5 if V3a==124
*Australia
replace wfs=17.1 if V3a==36
*Czech Republic
replace wfs=19.1 if V3a==203
*Hungary
replace wfs=22.9 if V3a==348
*Poland
replace wfs=20.8 if V3a==616


*macro level variable: public spending on education (% of GDP), 2005, source: OECD Education Statistics.
gen educspend=.
*US
replace educspend=4.8 if V3a==840
*Sweden
replace educspend=6.2 if V3a==752
*Portugal
replace educspend=5.3 if V3a==620
*New Zealand
replace educspend=5.2 if V3a==554
*Norway
replace educspend=5.7 if V3a==578
*Netherlands
replace educspend=4.6 if V3a==528
*Japan
replace educspend=3.4 if V3a==392
*Ireland
replace educspend=4.3 if V3a==372
*Great Britain
replace educspend=5.0 if V3a==826
*France
replace educspend=5.6 if V3a==250
*Finland
replace educspend=5.9 if V3a==246
*Spain
replace educspend=4.1 if V3a==724
*Denmark
replace educspend=6.8 if V3a==208
*Germany
replace educspend=4.2 if V3a==276
*Switzerland
replace educspend=5.6 if V3a==756
*Canada
replace educspend=4.7 if V3a==124
*Australia
replace educspend=4.3 if V3a==36
*Czech Republic
replace educspend=4.2 if V3a==203
*Hungary
replace educspend=5.1 if V3a==348
*Poland
replace educspend=5.2 if V3a==616

*macro level variable: gross national income per capita, 2006, US dollars, current prices and PPPs, source: OECD Factbook.
gen gdpcap=.
*US
replace gdpcap=45575 if V3a==840
*Sweden
replace gdpcap=36139 if V3a==752
*Portugal
replace gdpcap=22180 if V3a==620
*New Zealand
replace gdpcap=25147 if V3a==554
*Norway
replace gdpcap=53327 if V3a==578
*Netherlands
replace gdpcap=39087 if V3a==528
*Japan
replace gdpcap=32771 if V3a==392
*Ireland
replace gdpcap=37035 if V3a==372
*Great Britain
replace gdpcap=35160 if V3a==826
*France
replace gdpcap=31968 if V3a==250
*Finland
replace gdpcap=33409 if V3a==246
*Spain
replace gdpcap=29843 if V3a==724
*Denmark
replace gdpcap=36698 if V3a==208
*Germany
replace gdpcap=34413 if V3a==276
*Switzerland
replace gdpcap=42092 if V3a==756
*Canada
replace gdpcap=36492 if V3a==124
*Australia
replace gdpcap=35511 if V3a==36
*Czech Republic
replace gdpcap=21240 if V3a==203
*Hungary
replace gdpcap=17343 if V3a==348
*Poland
replace gdpcap=14685 if V3a==616


*macro level variable: tertiary enrolment, 2005, source: OECD Education Statistics.
gen terenrol=.
*US
replace terenrol=82.72 if V3a==840
*Sweden
replace terenrol=81.66 if V3a==752
*Portugal
replace terenrol=56.47 if V3a==620
*New Zealand
replace terenrol=81.93 if V3a==554
*Norway
replace terenrol=79.66 if V3a==578
*Netherlands
replace terenrol=60.71 if V3a==528
*Japan
replace terenrol=55.31 if V3a==392
*Ireland
replace terenrol=59.31 if V3a==372
*Great Britain
replace terenrol=59.71 if V3a==826
*France
replace terenrol=56.39 if V3a==250
*Finland
replace terenrol=91.69 if V3a==246
*Spain
replace terenrol=66.87 if V3a==724
*Denmark
replace terenrol=80.46 if V3a==208
*Germany
replace terenrol=64.4 if V3a==276
*Switzerland
replace terenrol=47.42 if V3a==756
*Canada
replace terenrol=62.34 if V3a==124
*Australia
replace terenrol=71.83 if V3a==36

*macro level variable: educational inequality (odds measure, after taking into accont math score), source: OECD Education at a Glance 2007: 87.
gen educodds=.
*US
replace educodds=1.9 if V3a==840
*Sweden
replace educodds=1.8 if V3a==752
*Portugal
replace educodds=1.8 if V3a==620
*New Zealand
replace educodds=1.6 if V3a==554
*Norway
replace educodds=2 if V3a==578
*Netherlands
replace educodds=1.5 if V3a==528
*Japan
replace educodds=2.1 if V3a==392
*Ireland
replace educodds=1.8 if V3a==372
*Great Britain
replace educodds=1.8 if V3a==826
*France
replace educodds=1.7 if V3a==250
*Finland
replace educodds=1.7 if V3a==246
*Spain
replace educodds=2 if V3a==724
*Denmark
replace educodds=1.8 if V3a==208
*Germany
replace educodds=2.3 if V3a==276
*Switzerland
replace educodds=2.5 if V3a==756
*Canada
replace educodds=1.9 if V3a==124
*Australia
replace educodds=1.8 if V3a==36


*macro level variable: educational inequality (odds measure, before taking math score into account), source: OECD Education at a Glance 2007: 87.
gen educodds2=.
*US
replace educodds2=2.2 if V3a==840
*Sweden
replace educodds2=2.1 if V3a==752
*Portugal
replace educodds2=2.3 if V3a==620
*New Zealand
replace educodds2=2.0 if V3a==554
*Norway
replace educodds2=2.4 if V3a==578
*Netherlands
replace educodds2=2.2 if V3a==528
*Japan
replace educodds2=2.5 if V3a==392
*Ireland
replace educodds2=2.2 if V3a==372
*Great Britain
replace educodds2=2.4 if V3a==826
*France
replace educodds2=2.3 if V3a==250
*Finland
replace educodds2=1.8 if V3a==246
*Spain
replace educodds2=2.5 if V3a==724
*Denmark
replace educodds2=2.2 if V3a==208
*Germany
replace educodds2=3.2 if V3a==276
*Switzerland
replace educodds2=3.1 if V3a==756
*Canada
replace educodds2=2.2 if V3a==124
*Australia
replace educodds2=2.2 if V3a==36



*macro level variable: educational inequality (Pfeffer measure), source: Pfeffer 2008.
gen educmobil=.
*US
replace educmobil=0.14 if V3a==840
*Sweden
replace educmobil=0.1 if V3a==752
*Portugal missing

*New Zealand
replace educmobil=0.19 if V3a==554
*Norway
replace educmobil=-0.15 if V3a==578
*Netherlands missing

*Japan missing

*Ireland
replace educmobil=-0.04 if V3a==372
*Great Britain
replace educmobil=0.14 if V3a==826
*France missing

*Finland
replace educmobil=0.24 if V3a==246
*Spain missing

*Denmark
replace educmobil=0.16 if V3a==208
*Germany
replace educmobil=-0.27 if V3a==276
*Switzerland
replace educmobil=-0.17 if V3a==756
*Canada
replace educmobil=0.13 if V3a==124
*Australia missing



*macro level variable: relative share of public spending, all levels of education, 2006, source: OECD 2009: Education at a Glance, 231.
gen proppuball=.
*US
replace proppuball=68.0 if V3a==840
*Sweden
replace proppuball=97.3 if V3a==752
*Portugal
replace proppuball=92.0 if V3a==620
*New Zealand
replace proppuball=79.9 if V3a==554
*Norway
replace proppuball=95.0 if V3a==578
*Netherlands
replace proppuball=84.3 if V3a==528
*Japan
replace proppuball=66.7 if V3a==392
*Ireland
replace proppuball=94.0 if V3a==372
*Great Britain
replace proppuball=75.3 if V3a==826
*France
replace proppuball=90.9 if V3a==250
*Finland
replace proppuball=97.5 if V3a==246
*Spain
replace proppuball=88.9 if V3a==724
*Denmark
replace proppuball=91.9 if V3a==208
*Germany
replace proppuball=85.2 if V3a==276
*Switzerland, 2000
replace proppuball=92.1 if V3a==756
*Canada
replace proppuball=73.8 if V3a==124
*Australia
replace proppuball=72.4 if V3a==36
*Czech Republic
replace proppuball=88.4 if V3a==203
*Hungary
replace proppuball=90.5 if V3a==348
*Poland
replace proppuball=90.5 if V3a==616


*macro level variable: relative share of public spending, tertiary education, 2006, source: OECD 2009: Education at a Glance, 231.
gen proppubter=.
*US
replace proppubter=34.0 if V3a==840
*Sweden
replace proppubter=89.1 if V3a==752
*Portugal
replace proppubter=70.4 if V3a==620
*New Zealand
replace proppubter=63.0 if V3a==554
*Norway
replace proppubter=97.0 if V3a==578
*Netherlands
replace proppubter=73.4 if V3a==528
*Japan
replace proppubter=32.2 if V3a==392
*Ireland
replace proppubter=85.1 if V3a==372
*Great Britain
replace proppubter=64.8 if V3a==826
*France
replace proppubter=83.7 if V3a==250
*Finland
replace proppubter=95.5 if V3a==246
*Spain
replace proppubter=78.2 if V3a==724
*Denmark
replace proppubter=96.4 if V3a==208
*Germany
replace proppubter=85.0 if V3a==276
*Switzerland missing

*Canada
replace proppubter=53.4 if V3a==124
*Australia
replace proppubter=47.6 if V3a==36
*Czech Republic
replace proppubter=82.1 if V3a==203
*Hungary
replace proppubter=77.9 if V3a==348
*Poland
replace proppubter=70.4 if V3a==616


*macro level variable: relative share of private spending by households, tertiary education, 2006, where data not available, I use general share of private spending instead; source: OECD 2009: Education at a Glance, 233.
gen privhh=.
*US
replace privhh=36.3 if V3a==840
*Sweden
replace privhh=0 if V3a==752
*Portugal
replace privhh=27.6 if V3a==620
*New Zealand
replace privhh=37.0 if V3a==554
*Norway
replace privhh=3.0 if V3a==578
*Netherlands
replace privhh=15.5 if V3a==528
*Japan
replace privhh=51.4 if V3a==392
*Ireland
replace privhh=13.2 if V3a==372
*Great Britain
replace privhh=26.6 if V3a==826
*France
replace privhh=10.1 if V3a==250
*Finland
replace privhh=4.5 if V3a==246
*Spain
replace privhh=17.6 if V3a==724
*Denmark
replace privhh=3.6 if V3a==208
*Germany
replace privhh=15.0 if V3a==276
*Switzerland, missing

*Canada
replace privhh=22.2 if V3a==124
*Australia
replace privhh=35.8 if V3a==36
*Czech Republic
replace privhh=9.0 if V3a==203
*Hungary
replace privhh=22.1 if V3a==348
*Poland
replace privhh=29.6 if V3a==616


*macro level variable: relative share of private spending by households, all levels of education, 2006, where data not available, I use general share of private spending instead; source: OECD 2009: Education at a Glance, 231.
gen privhhall=.
*US
replace privhhall=20.3 if V3a==840
*Sweden
replace privhhall=0.1 if V3a==752
*Portugal
replace privhhall=6.7 if V3a==620
*New Zealand
replace privhhall=19.7 if V3a==554
*Norway, 2000
replace privhhall=5.0 if V3a==578
*Netherlands
replace privhhall=7.5 if V3a==528
*Japan
replace privhhall=21.8 if V3a==392
*Ireland
replace privhhall=5.6 if V3a==372
*Great Britain
replace privhhall=16.0 if V3a==826
*France
replace privhhall=6.8 if V3a==250
*Finland
replace privhhall=2.5 if V3a==246
*Spain
replace privhhall=10.1 if V3a==724
*Denmark
replace privhhall=4.5 if V3a==208
*Germany
replace privhhall=14.8 if V3a==276
*Switzerland, 2000
replace privhhall=7.9 if V3a==756
*Canada
replace privhhall=11.7 if V3a==124
*Australia
replace privhhall=20.7 if V3a==36
*Czech Republic
replace privhhall=7.9 if V3a==203
*Hungary
replace privhhall=9.5 if V3a==348
*Poland
replace privhhall=9.5 if V3a==616




*macro level variable: redistribtion (percentage reduction in inequality after transfer and taxes), source: OECD, 2008: Growing Unequqal, p. 110.
gen redismacro=.
*US
replace redismacro=0.185 if V3a==840
*Sweden
replace redismacro=0.400 if V3a==752
*Portugal missing

*New Zealand
replace redismacro=0.265 if V3a==554
*Norway
replace redismacro=0.310 if V3a==578
*Netherlands
replace redismacro=0.313 if V3a==528
*Japan
replace redismacro=0.133 if V3a==392
*Ireland
replace redismacro=0.305 if V3a==372
*Great Britain
replace redismacro=0.274 if V3a==826
*France
replace redismacro=0.218 if V3a==250
*Finland
replace redismacro=0.282 if V3a==246
*Spain missing

*Denmark
replace redismacro=0.413 if V3a==208
*Germany
replace redismacro=0.311 if V3a==276
*Switzerland
replace redismacro=0.141 if V3a==756
*Canada
replace redismacro=0.240 if V3a==124
*Australia
replace redismacro=0.326 if V3a==36



*macro level variable: relative share of VET in upper secondary education (vocational and pre-vocational), 2007, Source: OECD 2009, p. 306.
gen vocshare=.
*US
replace vocshare=0.01 if V3a==840
*Sweden
replace vocshare=56.2 if V3a==752
*Portugal
replace vocshare=31.5 if V3a==620
*New Zealand

*Norway
replace vocshare=57.5 if V3a==578
*Netherlands
replace vocshare=67.6 if V3a==528
*Japan
replace vocshare=23.4 if V3a==392
*Ireland
replace vocshare=33.5 if V3a==372
*Great Britain
replace vocshare=41.4 if V3a==826
*France
replace vocshare=43.8 if V3a==250
*Finland
replace vocshare=66.7 if V3a==246
*Spain
replace vocshare=43.4 if V3a==724
*Denmark
replace vocshare=47.7 if V3a==208
*Germany
replace vocshare=57.4 if V3a==276
*Switzerland
replace vocshare=64.8 if V3a==756
*Canada
replace vocshare=5.5 if V3a==124
*Australia
replace vocshare=60.4 if V3a==36
*Czech Republic
replace vocshare=75.2 if V3a==203
*Hungary
replace vocshare=23.6 if V3a==348
*Poland
replace vocshare=44.3 if V3a==616




*macro level variable: union density, 2006, source: Armingeon Dataset, OECD data.
gen unionden=.
*US
replace unionden=11.48 if V3a==840
*Sweden
replace unionden=74.06 if V3a==752
*Portugal
replace unionden=20.83 if V3a==620
*New Zealand
replace unionden=21.2 if V3a==554
*Norway
replace unionden=54.85 if V3a==578
*Netherlands
replace unionden=20.47 if V3a==528
*Japan
replace unionden=18.35 if V3a==392
*Ireland
replace unionden=35.53 if V3a==372
*Great Britain
replace unionden=28.36 if V3a==826
*France
replace unionden=7.65 if V3a==250
*Finland
replace unionden=71.7 if V3a==246
*Spain
replace unionden=15.02 if V3a==724
*Denmark
replace unionden=69.43 if V3a==208
*Germany
replace unionden=20.72 if V3a==276
*Switzerland
replace unionden=18.86 if V3a==756
*Canada
replace unionden=29.79 if V3a==124
*Australia
replace unionden=19.84 if V3a==36
*Czech Republic
replace unionden=18.7 if V3a==203
*Hungary
replace unionden=17.0 if V3a==348
*Poland
replace unionden=16.8 if V3a==616



*macro level variable: cumulative share of left government, 1990-2006, source: Armingeon Dataset.
gen leftgov=.
*US
replace leftgov=0 if V3a==840
*Sweden
replace leftgov=80.8 if V3a==752
*Portugal
replace leftgov=33.6 if V3a==620
*New Zealand
replace leftgov=46.4 if V3a==554
*Norway
replace leftgov=55.8 if V3a==578
*Netherlands
replace leftgov=30.9 if V3a==528
*Japan
replace leftgov=5.8 if V3a==392
*Ireland
replace leftgov=11.3 if V3a==372
*Great Britain
replace leftgov=56.8 if V3a==826
*France
replace leftgov=43.9 if V3a==250
*Finland
replace leftgov=37.8 if V3a==246
*Spain
replace leftgov=53.1 if V3a==724
*Denmark
replace leftgov=38.7 if V3a==208
*Germany
replace leftgov=44.8 if V3a==276
*Switzerland
replace leftgov=28 if V3a==756
*Canada
replace leftgov=0 if V3a==124
*Australia
replace leftgov=36.4 if V3a==36
*Czech Republic

*Hungary

*Poland



*macro level variable: share of private spending on health care (private insurance and out of pocket), 2006, source: OECD.stats.
gen privsharehealth=.
*US
replace privsharehealth=49.8 if V3a==840
*Sweden
replace privsharehealth=17.4 if V3a==752
*Portugal
replace privsharehealth=31.6 if V3a==620
*New Zealand
replace privsharehealth=18.9 if V3a==554
*Norway
replace privsharehealth=16.5 if V3a==578
*Netherlands
replace privsharehealth=12.1 if V3a==528
*Japan
replace privsharehealth=19.9 if V3a==392
*Ireland

*Great Britain
replace privsharehealth=14.0 if V3a==826
*France
replace privsharehealth=20.2 if V3a==250
*Finland
replace privsharehealth=22.4 if V3a==246
*Spain
replace privsharehealth=28.1 if V3a==724
*Denmark
replace privsharehealth=16.0 if V3a==208
*Germany
replace privsharehealth=22.3 if V3a==276
*Switzerland
replace privsharehealth=39.9 if V3a==756
*Canada
replace privsharehealth=28.8 if V3a==124
*Australia
replace privsharehealth=28.1 if V3a==36
*Czech Republic
replace privsharehealth=11.8 if V3a==203
*Hungary
replace privsharehealth =26.6 if V3a==348
*Poland
replace privsharehealth=27.7 if V3a==616


*macro level variable: public share of spending on health care, 2005, source: OECD Health Data 2012.
gen pubsharehealth=.
*US
replace pubsharehealth=44.2 if V3a==840
*Sweden
replace pubsharehealth=81.2 if V3a==752
*Portugal
replace pubsharehealth=68.0 if V3a==620
*New Zealand
replace pubsharehealth=79.7 if V3a==554
*Norway
replace pubsharehealth=83.5 if V3a==578
*Netherlands
replace pubsharehealth=65.8 if V3a==528
*Japan
replace pubsharehealth=81.6 if V3a==392
*Ireland
replace pubsharehealth=75.9 if V3a==372
*Great Britain
replace pubsharehealth=81.7 if V3a==826
*France
replace pubsharehealth=78.8 if V3a==250
*Finland
replace pubsharehealth=75.4 if V3a==246
*Spain
replace pubsharehealth=71.0 if V3a==724
*Denmark
replace pubsharehealth=84.5 if V3a==208
*Germany
replace pubsharehealth=76.6 if V3a==276
*Switzerland
replace pubsharehealth=59.5 if V3a==756
*Canada
replace pubsharehealth=70.2 if V3a==124
*Australia
replace pubsharehealth=66.9 if V3a==36
*Czech Republic
replace pubsharehealth=87.3 if V3a==203
*Hungary
replace pubsharehealth=70.0 if V3a==348
*Poland
replace pubsharehealth=69.3 if V3a==616


*macro level variable: total spending on health care, % of GDP, 2005, source: OECD Health Data 2012.
gen totalspendhealth=.
*US
replace totalspendhealth=15.8 if V3a==840
*Sweden
replace totalspendhealth=9.1 if V3a==752
*Portugal
replace totalspendhealth=10.4 if V3a==620
*New Zealand
replace totalspendhealth=8.4 if V3a==554
*Norway
replace totalspendhealth=9.0 if V3a==578
*Netherlands
replace totalspendhealth=9.8 if V3a==528
*Japan
replace totalspendhealth=8.2 if V3a==392
*Ireland
replace totalspendhealth=7.6 if V3a==372
*Great Britain
replace totalspendhealth=8.2 if V3a==826
*France
replace totalspendhealth=11.2 if V3a==250
*Finland
replace totalspendhealth=8.4 if V3a==246
*Spain
replace totalspendhealth=8.3 if V3a==724
*Denmark
replace totalspendhealth=9.8 if V3a==208
*Germany
replace totalspendhealth=10.8 if V3a==276
*Switzerland
replace totalspendhealth=11.2 if V3a==756
*Canada
replace totalspendhealth=9.8 if V3a==124
*Australia
replace totalspendhealth=8.4 if V3a==36
*Czech Republic
replace totalspendhealth=6.9 if V3a==203
*Hungary
replace totalspendhealth=8.4 if V3a==348
*Poland
replace totalspendhealth=6.2 if V3a==616



*macro level variable: openness, 2000, source: Armingeon dataset and OECD Factbook 2009.
gen open=.
*US
replace open=26.34 if V3a==840
*Sweden
replace open=86.89 if V3a==752
*Portugal
replace open=70.41 if V3a==620
*New Zealand
replace open=69.35 if V3a==554
*Norway
replace open=75.96 if V3a==578
*Netherlands
replace open=134.62 if V3a==528
*Japan
replace open=20.52 if V3a==392
*Ireland
replace open=184.01 if V3a==372
*Great Britain
replace open=57.83 if V3a==826
*France
replace open=56.23 if V3a==250
*Finland
replace open=76.89 if V3a==246
*Spain
replace open=61.20 if V3a==724
*Denmark
replace open=87.15 if V3a==208
*Germany
replace open=66.40 if V3a==276
*Switzerland
replace open=87.14 if V3a==756
*Canada
replace open=85.46 if V3a==124
*Australia
replace open=45.00 if V3a==36
*Czech Republic
replace open=129.8 if V3a==203
*Hungary
replace open=147.8 if V3a==348
*Poland
replace open=60.6 if V3a==616


*macro level variable: openness, 2005, source: Armingeon dataset and OECD Factbook 2009.
gen open05=.
*US
replace open05=26.49 if V3a==840
*Sweden
replace open05=89.04 if V3a==752
*Portugal
replace open05=64.96 if V3a==620
*New Zealand
replace open05=57.01 if V3a==554
*Norway
replace open05=72.8 if V3a==578
*Netherlands
replace open05=130.72 if V3a==528
*Japan
replace open05=27.28 if V3a==392
*Ireland
replace open05=150.7 if V3a==372
*Great Britain
replace open05=56.17 if V3a==826
*France
replace open05=52.98 if V3a==250
*Finland
replace open05=79.49 if V3a==246
*Spain
replace open05=56.69 if V3a==724
*Denmark
replace open05=93.07 if V3a==208
*Germany
replace open05=76.92 if V3a==276
*Switzerland
replace open05=91.28 if V3a==756
*Canada
replace open05=71.92 if V3a==124
*Australia
replace open05=40.64 if V3a==36
*Czech Republic
replace open05=141.2 if V3a==203
*Hungary
replace open05=133.8 if V3a==348
*Poland
replace open05=75 if V3a==616


*macro level variable: net Gini, 2000, source: Solt WIID.
gen inequality=.
*US
replace inequality=36.8 if V3a==840
*Sweden
replace inequality=25.2 if V3a==752
*Portugal
replace inequality=35.4 if V3a==620
*New Zealand
replace inequality=33.5 if V3a==554
*Norway
replace inequality=25 if V3a==578
*Netherlands
replace inequality=23.85 if V3a==528
*Japan
replace inequality=32.75 if V3a==392
*Ireland
replace inequality=31.3 if V3a==372
*Great Britain
replace inequality=34.20 if V3a==826
*France
replace inequality=27.8 if V3a==250
*Finland
replace inequality=24.6 if V3a==246
*Spain
replace inequality=33.6 if V3a==724
*Denmark
replace inequality=22.5 if V3a==208
*Germany
replace inequality=27.5 if V3a==276
*Switzerland
replace inequality=28 if V3a==756
*Canada
replace inequality=31.5 if V3a==124
*Australia
replace inequality=31.7 if V3a==36
*Czech Republic
replace inequality=25.89 if V3a==203
*Hungary
replace inequality=31.29 if V3a==348
*Poland
replace inequality=28.60 if V3a==616



*macro level variable: public education spending, % of GDP, 2000, source: OECD.stats and OECD Factbook. (East European Countries, value for 2001)
gen educspendmacro00=.
*US
replace educspendmacro00=4.8 if V3a==840
*Sweden
replace educspendmacro00=6.3 if V3a==752
*Portugal
replace educspendmacro00=5.6 if V3a==620
*New Zealand
replace educspendmacro00=5.8 if V3a==554
*Norway
replace educspendmacro00=5.8 if V3a==578
*Netherlands
replace educspendmacro00=4.3 if V3a==528
*Japan
replace educspendmacro00=3.5 if V3a==392
*Ireland
replace educspendmacro00=4.1 if V3a==372
*Great Britain
replace educspendmacro00=4.5 if V3a==826
*France
replace educspendmacro00=5.7 if V3a==250
*Finland
replace educspendmacro00=5.5 if V3a==246
*Spain
replace educspendmacro00=4.3 if V3a==724
*Denmark
replace educspendmacro00=6.4 if V3a==208
*Germany
replace educspendmacro00=4.3 if V3a==276
*Switzerland
replace educspendmacro00=5.3 if V3a==756
*Canada
replace educspendmacro00=5.2 if V3a==124
*Australia
replace educspendmacro00=5.4 if V3a==36
*Czech Republic
replace educspendmacro00=4.2 if V3a==203
*Hungary
replace educspendmacro00=4.6 if V3a==348
*Poland
replace educspendmacro00=5.6 if V3a==616

*macro level variable: electoral institutions (PR=0, Maj1=1, Maj2=2), source: Armingeon et al. dataset.
gen singmemd=.
*US
replace singmemd=2 if V3a==840
*Sweden
replace singmemd=0 if V3a==752
*Portugal
replace singmemd=0 if V3a==620
*New Zealand
replace singmemd=2 if V3a==554
*Norway
replace singmemd=0 if V3a==578
*Netherlands
replace singmemd=0 if V3a==528
*Japan
replace singmemd=1 if V3a==392
*Ireland
replace singmemd=0 if V3a==372
*Great Britain
replace singmemd=2 if V3a==826
*France
replace singmemd=1 if V3a==250
*Finland
replace singmemd=0 if V3a==246
*Spain
replace singmemd=0 if V3a==724
*Denmark
replace singmemd=0 if V3a==208
*Germany
replace singmemd=0 if V3a==276
*Switzerland
replace singmemd=0 if V3a==756
*Canada
replace singmemd=2 if V3a==124
*Australia
replace singmemd=1 if V3a==36
*Czech Republic
replace singmemd=0 if V3a==203
*Hungary
replace singmemd=1 if V3a==348
*Poland
replace singmemd=0 if V3a==616



*macro level variable: all public social spending, % of GDP, 2005, source: OECD Social Expenditure database.
gen pubsocspend05=.
*US
replace pubsocspend05=16.0 if V3a==840
*Sweden
replace pubsocspend05=29.1 if V3a==752
*Portugal
replace pubsocspend05=23.0 if V3a==620
*New Zealand
replace pubsocspend05=18.1 if V3a==554
*Norway
replace pubsocspend05=21.6 if V3a==578
*Netherlands
replace pubsocspend05=20.7 if V3a==528
*Japan
replace pubsocspend05=18.6 if V3a==392
*Ireland
replace pubsocspend05=16.0 if V3a==372
*Great Britain
replace pubsocspend05=20.5 if V3a==826
*France
replace pubsocspend05=30.1 if V3a==250
*Finland
replace pubsocspend05=26.2 if V3a==246
*Spain
replace pubsocspend05=21.1 if V3a==724
*Denmark
replace pubsocspend05=27.7 if V3a==208
*Germany
replace pubsocspend05=27.3 if V3a==276
*Switzerland
replace pubsocspend05=20.3 if V3a==756
*Canada
replace pubsocspend05=16.9 if V3a==124
*Australia
replace pubsocspend05=16.5 if V3a==36
*Czech Republic
replace pubsocspend05=18.7 if V3a==203
*Hungary
replace pubsocspend05=22.5 if V3a==348
*Poland
replace pubsocspend05=21.0 if V3a==616


*macro level variable: mandatory and voluntary private social spending, % of GDP, 2005, source: OECD Social Expenditure database.
gen privsocspend05=.
*US
replace privsocspend05=10.2 if V3a==840
*Sweden
replace privsocspend05=2.9 if V3a==752
*Portugal
replace privsocspend05=2.0 if V3a==620
*New Zealand
replace privsocspend05=0.4 if V3a==554
*Norway
replace privsocspend05=2.0 if V3a==578
*Netherlands
replace privsocspend05=8.2 if V3a==528
*Japan
replace privsocspend05=3.0 if V3a==392
*Ireland
replace privsocspend05=1.4 if V3a==372
*Great Britain
replace privsocspend05=6.3 if V3a==826
*France
replace privsocspend05=3.1 if V3a==250
*Finland
replace privsocspend05=1.1 if V3a==246
*Spain
replace privsocspend05=0.5 if V3a==724
*Denmark
replace privsocspend05=2.6 if V3a==208
*Germany
replace privsocspend05=3.0 if V3a==276
*Switzerland
replace privsocspend05=8.3 if V3a==756
*Canada
replace privsocspend05=5.5 if V3a==124
*Australia
replace privsocspend05=2.9 if V3a==36
*Czech Republic
replace privsocspend05=0.4 if V3a==203
*Hungary
replace privsocspend05=0.1 if V3a==348
*Poland
replace privsocspend05=0 if V3a==616


*macro level variable: public pension spending, % of GDP, 2005, source: OECD Social Expenditure Database
gen pubpension05=.
*US
replace pubpension05=5.3 if V3a==840
*Sweden
replace pubpension05=9.4 if V3a==752
*Portugal
replace pubpension05=8.9 if V3a==620
*New Zealand
replace pubpension05=4.1 if V3a==554
*Norway
replace pubpension05=6.3 if V3a==578
*Netherlands
replace pubpension05=5.5 if V3a==528
*Japan
replace pubpension05=8.6 if V3a==392
*Ireland
replace pubpension05=2.9 if V3a==372
*Great Britain
replace pubpension05=5.9 if V3a==826
*France
replace pubpension05=10.9 if V3a==250
*Finland
replace pubpension05=8.5 if V3a==246
*Spain
replace pubpension05=6.5 if V3a==724
*Denmark
replace pubpension05=7.3 if V3a==208
*Germany
replace pubpension05=9.1 if V3a==276
*Switzerland
replace pubpension05=6.7 if V3a==756
*Canada
replace pubpension05=3.7 if V3a==124
*Australia
replace pubpension05=4.3 if V3a==36
*Czech Republic
replace pubpension05=6.6 if V3a==203
*Hungary
replace pubpension05=7.8 if V3a==348
*Poland
replace pubpension05=9.3 if V3a==616


*macro level variable: mandatory and voluntary pension spending, % of GDP, 2005, source: OECD Social Expenditure Database
gen privpension05=.
*US
replace privpension05=3.8 if V3a==840
*Sweden
replace privpension05=2.1 if V3a==752
*Portugal
replace privpension05=0.3 if V3a==620
*New Zealand
replace privpension05=. if V3a==554
*Norway
replace privpension05=0.3 if V3a==578
*Netherlands
replace privpension05=3.5 if V3a==528
*Japan
replace privpension05=2.6 if V3a==392
*Ireland
replace privpension05=0.8 if V3a==372
*Great Britain
replace privpension05=4.6 if V3a==826
*France
replace privpension05=0.2 if V3a==250
*Finland
replace privpension05=0.2 if V3a==246
*Spain
replace privpension05=0 if V3a==724
*Denmark
replace privpension05=2.3 if V3a==208
*Germany
replace privpension05=0.8 if V3a==276
*Switzerland
replace privpension05=5.3 if V3a==756
*Canada
replace privpension05=4.3 if V3a==124
*Australia
replace privpension05=2.3 if V3a==36
*Czech Republic
replace privpension05=0.2 if V3a==203
*Hungary
replace privpension05=. if V3a==348
*Poland
replace privpension05=. if V3a==616



*macro level variable: public pension spending, different version, % of GDP, 2005, source: OECD General Database (OECD (2017), Pension spending (indicator). doi: 10.1787/a041f4ef-en (Accessed on 25 April 2017))
gen alt_pubpension05=.
*US
replace alt_pubpension05=5.7 if V3a==840
*Sweden
replace alt_pubpension05=7.6 if V3a==752
*Portugal
replace alt_pubpension05=10.3 if V3a==620
*New Zealand
replace alt_pubpension05=4.2 if V3a==554
*Norway
replace alt_pubpension05=4.8 if V3a==578
*Netherlands
replace alt_pubpension05=5.0 if V3a==528
*Japan
replace alt_pubpension05=8.5 if V3a==392
*Ireland
replace alt_pubpension05=3.4 if V3a==372
*Great Britain
replace alt_pubpension05=5.5 if V3a==826
*France
replace alt_pubpension05=12.4 if V3a==250
*Finland
replace alt_pubpension05=8.4 if V3a==246
*Spain
replace alt_pubpension05=8.1 if V3a==724
*Denmark
replace alt_pubpension05=5.4 if V3a==208
*Germany
replace alt_pubpension05=11.5 if V3a==276
*Switzerland
replace alt_pubpension05=6.6 if V3a==756
*Canada
replace alt_pubpension05=4.0 if V3a==124
*Australia
replace alt_pubpension05=3.3 if V3a==36
*Czech Republic
replace alt_pubpension05=7.0 if V3a==203
*Hungary
replace alt_pubpension05=8.5 if V3a==348
*Poland
replace alt_pubpension05=11.4 if V3a==616


*macro level variable: private pension spending, % of GDP, 2005, source: OECD General Database (OECD (2017), Pension spending (indicator). doi: 10.1787/a041f4ef-en (Accessed on 25 April 2017))
gen alt_privpension05=.
*US
replace alt_privpension05=3.8 if V3a==840
*Sweden
replace alt_privpension05=0.9 if V3a==752
*Portugal
replace alt_privpension05=0.8 if V3a==620
*New Zealand
replace alt_privpension05=1.3 if V3a==554
*Norway
replace alt_privpension05=0.9 if V3a==578
*Netherlands
replace alt_privpension05=3.3 if V3a==528
*Japan
replace alt_privpension05=0.2 if V3a==392
*Ireland
replace alt_privpension05=. if V3a==372
*Great Britain
replace alt_privpension05=2.8 if V3a==826
*France
replace alt_privpension05=. if V3a==250
*Finland
replace alt_privpension05=0.5 if V3a==246
*Spain
replace alt_privpension05=0.5 if V3a==724
*Denmark
replace alt_privpension05=3.3 if V3a==208
*Germany
replace alt_privpension05=0.1 if V3a==276
*Switzerland
replace alt_privpension05=4.8 if V3a==756
*Canada
replace alt_privpension05=2.0 if V3a==124
*Australia
replace alt_privpension05=3.6 if V3a==36
*Czech Republic
replace alt_privpension05=. if V3a==203
*Hungary
replace alt_privpension05=0.1 if V3a==348
*Poland
replace alt_privpension05=0.0 if V3a==616





*macro level variable: difference in net replacement rates for initial unemployment betwenn 150% and 67% of AW (average worker), family with 2 children, one-earner married couple, including social assistance top ups, 2005, OECD Benefts and Wages Database [substract low wage value from high wage value, i.e. this indicator measures the bias in favor of low-income people]

gen stratunem05=.
*US
replace stratunem05=21 if V3a==840
*Sweden
replace stratunem05=11 if V3a==752
*Portugal
replace stratunem05=4 if V3a==620
*New Zealand
replace stratunem05=30 if V3a==554
*Norway
replace stratunem05=45 if V3a==578
*Netherlands
replace stratunem05=31 if V3a==528
*Japan
replace stratunem05=35 if V3a==392
*Ireland
replace stratunem05=32 if V3a==372
*Great Britain
replace stratunem05=29 if V3a==826
*France
replace stratunem05=6 if V3a==250
*Finland
replace stratunem05=30 if V3a==246
*Spain
replace stratunem05=23 if V3a==724
*Denmark
replace stratunem05=18 if V3a==208
*Germany
replace stratunem05=24 if V3a==276
*Switzerland
replace stratunem05=11 if V3a==756
*Canada
replace stratunem05=15 if V3a==124
*Australia
replace stratunem05=25 if V3a==36
*Czech Republic
replace stratunem05=15 if V3a==203
*Hungary
replace stratunem05=22 if V3a==348
*Poland
replace stratunem05=30 if V3a==616





*macro level variable: difference in net replacement rates for pensions, mid 2000s, difference between low-wage (half of mean) and high-wage (twice the mean) earner, source: OECD Pensions at a Glance 2007 [higher values indicate stronger bias in favor of poor]

gen stratpension05=.
*US
replace stratpension05=24.2 if V3a==840
*Sweden
replace stratpension05=7.5 if V3a==752
*Portugal
replace stratpension05=7.9 if V3a==620
*New Zealand
replace stratpension05=58.2 if V3a==554
*Norway
replace stratpension05=22 if V3a==578
*Netherlands
replace stratpension05=2.2 if V3a==528
*Japan
replace stratpension05=21.2 if V3a==392
*Ireland
replace stratpension05=42.3 if V3a==372
*Great Britain
replace stratpension05=42.1 if V3a==826
*France
replace stratpension05=23 if V3a==250
*Finland
replace stratpension05=6.9 if V3a==246
*Spain
replace stratpension05=9.6 if V3a==724
*Denmark
replace stratpension05=60.5 if V3a==208
*Germany
replace stratpension05=9 if V3a==276
*Switzerland
replace stratpension05=39.9 if V3a==756
*Canada
replace stratpension05=58.4 if V3a==124
*Australia
replace stratpension05=42.7 if V3a==36
*Czech Republic
replace stratpension05=58.6 if V3a==203
*Hungary
replace stratpension05=-3.8 if V3a==348
*Poland
replace stratpension05=-2.6 if V3a==616






*macro level variable: income-related differences in access to health care (total physician utilization), ca. 2000, source: Van Doorslear et al. 2004: 54.

gen strathealth=.
*US
replace strathealth=0.068 if V3a==840
*Sweden
replace strathealth=0.042 if V3a==752
*Portugal
replace strathealth=0.068 if V3a==620
*New Zealand
*missing
*Norway
replace strathealth=0.009 if V3a==578
*Netherlands
replace strathealth=-0.017 if V3a==528
*Japan
*missing
*Ireland
replace strathealth=-0.032 if V3a==372
*Great Britain
replace strathealth=0.003 if V3a==826
*France
replace strathealth=0.017 if V3a==250
*Finland
replace strathealth=0.073 if V3a==246
*Spain
replace strathealth=-0.012 if V3a==724
*Denmark
replace strathealth=0.005 if V3a==208
*Germany
replace strathealth=0.010 if V3a==276
*Switzerland
replace strathealth=-0.008 if V3a==756
*Canada
replace strathealth=0.005 if V3a==124
*Australia
replace strathealth=0.003 if V3a==36
*Czech Republic
*missing
*Hungary
replace strathealth=0.003 if V3a==348
*Poland
*missing




*macro level variable: pension progressivity index, source: OECD Pensions at a Glance, 2007, p. 45

gen progpension05=.
*US
replace progpension05=40.9 if V3a==840
*Sweden
replace progpension05=12.9 if V3a==752
*Portugal
replace progpension05=18.8 if V3a==620
*New Zealand
replace progpension05=100 if V3a==554
*Norway
replace progpension05=37.4 if V3a==578
*Netherlands
replace progpension05=0 if V3a==528
*Japan
replace progpension05=46.9 if V3a==392
*Ireland
replace progpension05=100 if V3a==372
*Great Britain
replace progpension05=81.1 if V3a==826
*France
replace progpension05=24.6 if V3a==250
*Finland
replace progpension05=7.6 if V3a==246
*Spain
replace progpension05=18.8 if V3a==724
*Denmark
replace progpension05=59.3 if V3a==208
*Germany
replace progpension05=26.7 if V3a==276
*Switzerland
replace progpension05=53.3 if V3a==756
*Canada
replace progpension05=86.6 if V3a==124
*Australia
replace progpension05=73.1 if V3a==36
*Czech Republic
replace progpension05=68 if V3a==203
*Hungary
replace progpension05=1.3 if V3a==348
*Poland
replace progpension05=6.5 if V3a==616




*add spending data on unemployment, public spending on unemployment benefits, percent of GDP, 2005, source: oecd.stat online database

gen unempl_macro=.
*US
replace unempl_macro=0.3 if V3a==840
*Sweden
replace unempl_macro=1.1 if V3a==752
*Portugal
replace unempl_macro=1.3 if V3a==620
*New Zealand
replace unempl_macro=0.4 if V3a==554
*Norway
replace unempl_macro=0.5 if V3a==578
*Netherlands
replace unempl_macro=1.5 if V3a==528
*Japan
replace unempl_macro=0.3 if V3a==392
*Ireland
replace unempl_macro=0.9 if V3a==372
*Great Britain
replace unempl_macro=0.2 if V3a==826
*France
replace unempl_macro=1.7 if V3a==250
*Finland
replace unempl_macro=1.9 if V3a==246
*Spain
replace unempl_macro=1.8 if V3a==724
*Denmark
replace unempl_macro=0.0 if V3a==208
*Germany
replace unempl_macro=1.8 if V3a==276
*Switzerland
replace unempl_macro=0.9 if V3a==756
*Canada
replace unempl_macro=0.6 if V3a==124
*Australia
replace unempl_macro=0.5 if V3a==36
*Czech Republic
replace unempl_macro=0.6 if V3a==203
*Hungary
replace unempl_macro=0.5 if V3a==348
*Poland
replace unempl_macro=0.5 if V3a==616




*add spending data on pensions, public spending on old-age pensions, percent of GDP, 2005, source: oecd.stat online database

gen pensions_macro=.
*US
replace pensions_macro=5.0 if V3a==840
*Sweden
replace pensions_macro=8.9 if V3a==752
*Portugal
replace pensions_macro=8.6 if V3a==620
*New Zealand
replace pensions_macro=4.1 if V3a==554
*Norway
replace pensions_macro=6.2 if V3a==578
*Netherlands
replace pensions_macro=5.2 if V3a==528
*Japan
replace pensions_macro=8.5 if V3a==392
*Ireland
replace pensions_macro=2.7 if V3a==372
*Great Britain
replace pensions_macro=5.6 if V3a==826
*France
replace pensions_macro=10.6 if V3a==250
*Finland
replace pensions_macro=8.1 if V3a==246
*Spain
replace pensions_macro=6.3 if V3a==724
*Denmark
replace pensions_macro=8.2 if V3a==208
*Germany
replace pensions_macro=8.8 if V3a==276
*Switzerland
replace pensions_macro=5.8 if V3a==756
*Canada
replace pensions_macro=3.6 if V3a==124
*Australia
replace pensions_macro=4.7 if V3a==36
*Czech Republic
replace pensions_macro=6.3 if V3a==203
*Hungary
replace pensions_macro=7.7 if V3a==348
*Poland
replace pensions_macro=9.3 if V3a==616





gen female=.
replace female=1 if SEX==2
replace female=0 if SEX==1

gen age=.
replace age=AGE if AGE<98

gen agegroups=.
replace agegroups=1 if age <30
replace agegroups=2 if age>=30 & age<45
replace agegroups=3 if age>=45 & age<60
replace agegroups=4 if age>=60 & age!=.


gen educ=.
replace educ=EDUCYRS if EDUCYRS<90


gen educredux=.
replace educredux=1 if EDUCYRS<10
replace educredux=2 if EDUCYRS>=10 & EDUCYRS<15
replace educredux=3 if EDUCYRS>=15 & EDUCYRS<20
replace educredux=4 if EDUCYRS>=20 & EDUCYRS<90


gen leftright=.
replace leftright=1 if PARTY_LR==1 | PARTY_LR==2
replace leftright=2 if PARTY_LR==3
replace leftright=3 if PARTY_LR==4 | PARTY_LR==5


gen educ1=.
replace educ1=1 if spendeduc==5 | spendeduc==4
replace educ1=2 if spendeduc==3
replace educ1=3 if spendeduc==1 | spendeduc==2

gen educ2=.
replace educ2=0 if spendeduc==3 | spendeduc==4 | spendeduc==5
replace educ2=1 if spendeduc==1 | spendeduc==2


gen pensions1=.
replace pensions1=1 if spendpensions==5 | spendpensions==4
replace pensions1=2 if spendpensions==3
replace pensions1=3 if spendpensions==1 | spendpensions==2

gen pensions2=.
replace pensions2=0 if spendpensions==3 | spendpensions==4 | spendpensions==5
replace pensions2=1 if spendpensions==1 | spendpensions==2


gen health1=.
replace health1=1 if spendhealth==5 | spendhealth==4
replace health1=2 if spendhealth==3
replace health1=3 if spendhealth==1 | spendhealth==2

gen health2=.
replace health2=0 if spendhealth==3 | spendhealth==4 | spendhealth==5
replace health2=1 if spendhealth==1 | spendhealth==2


gen unem1=.
replace unem1=1 if spendunem==5 | spendunem==4
replace unem1=2 if spendunem==3
replace unem1=3 if spendunem==1 | spendunem==2
	
gen unem2=.
replace unem2=0 if spendunem==3 | spendunem==4 | spendunem==5
replace unem2=1 if spendunem==1 | spendunem==2


factor unem1 health1 pensions1
predict redisspend1

factor unem2 health2 pensions2
predict redisspend2



gen retired=0 if WRKST<90
replace retired=1 if WRKST==7
replace retired=. if WRKST>90

gen student=0 if WRKST<90
replace student=1 if WRKST==6
replace student=. if WRKST>90

gen outsider=0 if WRKST<90
gen aux=.
replace aux=1 if WRKST==2 & (V45==1 | V45==2)
*include only those you think that people like me have no say in politics
replace outsider=1 if WRKST==3 | WRKST==5 | aux==1
replace outsider=. if WRKST>90
drop aux
* definition of outsiders: unemployed, employed (but less than part time, temporarily out of work), employed part time and thinking that people like me have no say in politics

gen insider=0 if WRKST<90
replace insider=1 if WRKST==1 | (WRKST==2 & (V45==3 | V45==4 | V45==5))
replace insider=. if WRKST>90
* def of insiders: employed, full-time; employed part time, but not think that people like me have no say in politics


gen children=.
replace children=0 if HHCYCLE<90
replace children=1 if HHCYCLE==2 | HHCYCLE==3 | HHCYCLE==4 | HHCYCLE==6 | HHCYCLE==7 | HHCYCLE==8 | HHCYCLE==10 | HHCYCLE==12 | HHCYCLE==14 | HHCYCLE==16 | HHCYCLE==18 | HHCYCLE==20 | HHCYCLE==22 | HHCYCLE==24 | HHCYCLE==26 | HHCYCLE==28

gen incsq=income*income

gen pubsec=.
replace pubsec=1 if SPWRKTYP==1 | SPWRKTYP==2
replace pubsec=0 if SPWRKTYP==3 | SPWRKTYP==4 | SPWRKTYP==6

gen pubsec2=.
replace pubsec2=1 if SPWRKTYP==1
replace pubsec2=0 if SPWRKTYP==2 | SPWRKTYP==3 | SPWRKTYP==4 | SPWRKTYP==6


*skill specificity
gen twodisco=int(ISCO88/100)

gen skillspec=.
replace skillspec=6.17 if twodisco==11
replace skillspec=2.84 if twodisco==12
replace skillspec=1.61 if twodisco==13
replace skillspec=3.95 if twodisco==21
replace skillspec=2.88 if twodisco==22
replace skillspec=1.30 if twodisco==23
replace skillspec=3.38 if twodisco==24
replace skillspec=6.00 if twodisco==31
replace skillspec=5.60 if twodisco==32
replace skillspec=2.44 if twodisco==33
replace skillspec=3.58 if twodisco==34
replace skillspec=1.80 if twodisco==41
replace skillspec=3.90 if twodisco==42
replace skillspec=3.02 if twodisco==51
replace skillspec=0.79 if twodisco==52
replace skillspec=4.67 if twodisco==61
replace skillspec=3.92 if twodisco==71
replace skillspec=3.84 if twodisco==72
replace skillspec=20.42 if twodisco==73
replace skillspec=9.45 if twodisco==74
replace skillspec=25.06 if twodisco==81
replace skillspec=12.28 if twodisco==82
replace skillspec=3.67 if twodisco==83
replace skillspec=7.39 if twodisco==91
replace skillspec=7.38 if twodisco==92
replace skillspec=6.46 if twodisco==93



save "/Users/mbusemeyerALT/Documents/Meine Dateien/Projekte/Laufende Projekte/Paper Preferences/ISSP Data/ISSP 2006 RoG_Clean.dta", replace
